package com.jnks.controller;


import com.jnks.constant.R;
import com.jnks.pojo.domain.dto.ManagementObj;
import com.jnks.pojo.domain.vo.ManagementObjAddReq;
import com.jnks.pojo.domain.vo.ManagementObjDelReq;
import com.jnks.pojo.domain.vo.ManagementObjEditReq;
import com.jnks.service.ManagementObjService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 目标管理
 */
@Slf4j
@RestController
@RequestMapping("/vehicle/managementObj")
public class ManagementObjController {

    @Autowired
    private ManagementObjService managementObjService;

    /**
     * 新增目标管理
     *
     * @param request
     * @return
     * @throws
     */
    @PostMapping("/add")
    public R addManagementObj(@RequestBody ManagementObjAddReq request) {
        R data = R.data(managementObjService.addManagementObj(request)).getData();
        return data;
    }

    /**
     * 修改目标管理
     *
     * @param request
     * @return
     * @throws
     */
    @PostMapping("/edit")
    public R editManagementObj(@RequestBody ManagementObjEditReq request) {
        R data = R.data(managementObjService.editManagementObj(request)).getData();
        return data;
    }

    /**
     * 删除目标管理
     *
     * @param req
     * @return
     * @throws
     */
    @PostMapping("/del")
    public R delManagementObj(@RequestBody ManagementObjDelReq req) {
        R data = R.data(managementObjService.delManagementObj(req)).getData();
        return data;
    }

    /**
     * 查询目标
     *
     * @return
     * @throws
     */
    @GetMapping("/selectCoordinateById")
    public R selectCoordinateById() {
        List<ManagementObj> managementCoordinates = managementObjService.selectCoordinateById();
        return R.data(managementCoordinates,"查询成功");
    }


}